<style>
    /* 根据字数修改 */
    .layui-form-label {
        width: 80px;
    }

    .layui-form-item .layui-input-inline {
        width: 240px;
    }
</style>
<div class="layuimini-container layuimini-page-anim">
    <!-- 用于创建子页面 -->
    <div class="page-create"></div>

    <!-- page-main-create -->
    <!-- 用于显示 隐藏 -->
    <div class="layuimini-main page-main-create">
        <div class="title-row layuimini-title ">
            <div class="title-left">
                <h4><span>发薪记录</span></h4>
            </div>
            <div class="title-right">
                <button type="reset" class="layui-btn  layui-btn-sm layui-btn-primary">导出</button>
            </div>
        </div>


        <div class="m-df">
            <form class="layui-form" action="" lay-filter="search-form">
                <div class="layui-form-item">
                    <div class="search-box-wrapper">
                        <div class="search-box-body">
                            <div class="layui-inline">
                                <label class="layui-form-label">交易时间</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="datePeriodStart" autocomplete="off" id="date_period_start"
                                        class="layui-input" placeholder="请选择">

                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">发薪账户</label>
                                <div class="layui-input-inline">
                                    <input type="text" placeholder="请输入" name="nickname" autocomplete="off"
                                        class="layui-input">

                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">订单状态</label>
                                <div class="layui-input-inline">
                                    <select class="layui-input" lay-append-to="body" placeholder="请选择"
                                        name="businessNames" lay-search>
                                        <option value="1">未完成</option>
                                        <option value="2">已完成</option>
                                    </select>

                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">收款方</label>
                                <div class="layui-input-inline">
                                    <input type="text" placeholder="请输入" name="nickname" autocomplete="off"
                                        class="layui-input">

                                </div>
                            </div>

                        </div>
                        <div class="search-box-btns">
                            <div class="switch-wrapper" id="toggleFormBtn">
                                <span>展开</span>
                                <i class="layui-icon layui-icon-down" id="toggleIcon"></i>
                            </div>
                            <button type="submit" class="layui-btn layui-btn-sm" lay-submit
                                lay-filter="data-search-btn">查询</button>
                            <button type="reset" class="layui-btn  layui-btn-sm layui-btn-primary">重置</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <div class="px-5 pb-5 font-weight">
            <span class="mr-5">人数统计： 0 人</span>
            <span class="mr-5">积分总计： 0 人</span>
        </div>
        <div class="px-5 table-stripe">
            <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
        </div>
        <script type="text/html" id="currentTableBar">
            <a class="layui-font-blue mr-3" lay-event="detail">查看</a>
        </script>

    </div>
</div>
<script>
    layui.use(['form', 'table', 'tabs', 'miniPage', 'element'], function () {
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table,
            tabs = layui.tabs,
            laydate = layui.laydate,
            layer = layui.layer,
            util = layui.util,
            element = layui.element,
            miniPage = layui.miniPage;
        /******************** 事件 start ********************/

        util.on('lay-on', {
            //导出
            'download': function () {
                console.log('导出---')
            }
        })
        /******************** 事件 end ********************/



        /******************** 渲染组件 start ********************/
        form.render('select'); //刷新select选择框渲染
        // 起始日期
        laydate.render({
            elem: '#date_period_start',
            range: true
        });
        // 起始日期
        laydate.render({
            elem: '#date_period',
            range: true
        });
        /******************** 渲染组件 end ********************/

        table.render({
            elem: '#currentTableId',
            url: 'api/table.json',
            cols: [[
                { type: 'numbers', align: 'center', width: 80, title: '序号' },
                { field: 'name', align: 'center', minWidth: 100, title: '发薪账户' },
                { field: 'name', align: 'center', minWidth: 100, title: '订单编号' },
                { field: 'name', align: 'center', minWidth: 140, title: '交易时间' },
                { field: 'name', align: 'center', minWidth: 140, title: '交易金额' },
                { field: 'name', align: 'center', minWidth: 140, title: '收款方' },
                { field: 'name', align: 'center', minWidth: 140, title: '收款方身份证' },
                { field: 'name', align: 'center', minWidth: 140, title: '账单周期' },
                { field: 'name', align: 'center', minWidth: 140, title: '账单对应积分' },
                { field: 'name', align: 'center', minWidth: 140, title: '订单状态' },
                { title: '操作', minWidth: 100, toolbar: '#currentTableBar', align: "center", fixed: 'right' }
            ]],
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            skin: 'grid',
            size: 'lg'
        });
        // 表头自定义元素工具事件
        table.on('colTool(currentTableFilter)', function (obj) {
            var event = obj.event;
            if (event === 'name_tips') {
                layer.tips(`
                    <p class="layui-font-13 layui-font-black mt-1">既工单验收通过的时间</p>
                    `, this, {
                    tips: [1, '#ffffff'],
                    area: ['200px', 'auto']

                });
            }
        });

        // 监听搜索操作
        form.on('submit(data-search-btn)', function (data) {
            var result = JSON.stringify(data.field);
            layer.alert(result, {
                title: '最终的搜索信息'
            });

            //执行搜索重载
            table.reload('currentTableId', {
                page: {
                    curr: 1
                }
                , where: {
                    searchParams: result
                }
            }, 'data');

            return false;
        });




        table.on('tool(currentTableFilter)', function (obj) {
            var data = obj.data;
            if (obj.event === 'detail') {  // 监听详情操作
                console.log('详情')
                var content = miniPage.getHrefContent('page/processSupervision/spotCheckManager/components/spotCheckPlanDetail.html');
                var openWH = miniPage.getOpenWidthHeight();
                var index = layer.open({
                    title: '查看',
                    type: 1,
                    shade: 0.2,
                    maxmin: false,
                    shadeClose: true,
                    area: ['1300px', 'auto'],
                    content: content
                });
            }
        });

        // 开启监听 折叠展开事件
        miniPage.listen()

    });
</script>